$(document).ready(function() {
    
    // Display class select on manage_users admin page when a student account is being created
    $("#add_user_role").change(toggle_class_select);
    function toggle_class_select() {
    	if ( $("#add_user_role").val() == 'student' ) {
    		$("#class_select_wrapper").slideDown();
    	} else {
    		$("#class_select_wrapper").slideUp();
    	}
    }

    $("#import_users_role").change(import_toggle_class_select);
    function import_toggle_class_select() {
        if ( $("#import_users_role").val() == 'student' ) {
            $("#import_user_class_select_wrapper").slideDown();
        } else {
            $("#import_user_class_select_wrapper").slideUp();
        }
    }    

    // Manage users - Show all user management options
    $('a.show_user_options').bind('click', function(e) {
        e.preventDefault();
        $(this).parent().parent().next('.user_options:first').fadeToggle();
    });

	// Timepicker on manage_classes admin page
    $('#timepicker_start').timepicker({
        defaultTime: '12:00',
        showLeadingZero: false
    });
    $('#timepicker_end').timepicker({
        defaultTime: '2:00',
        showLeadingZero: false
    });

    $( "#tabs" ).tabs();

});